package anonymouschat.client;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * NickList obj stores nick name information. Serializable.
 * 
 * @author hb
 * 
 */
public class NickNameList implements Serializable {

	private static final long serialVersionUID = 1L;

	private List<String> userNameList;

	private List<String> nickNameList;

	/**
	 * Default Constructor Construct NickList by local file
	 */
	public NickNameList() {
		userNameList = new ArrayList<String>();
		nickNameList = new ArrayList<String>();
	}

	public int size() {
		if (userNameList.size() == nickNameList.size())
			return userNameList.size();
		else {
			return 0;
		}
	}

	public List<String> getNickNameList() {
		return nickNameList;
	}

	public List<String> getUserIDList() {
		return userNameList;
	}

	public String getNickNameFor(String srcUser) {
		int i = this.userNameList.indexOf(srcUser);
		if (i < 0)
			return null;
		return this.nickNameList.get(i);
	}
}
